package mvcweb.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @Author acy
 * @Date 2019/04/29
 */
@Controller
@RequestMapping
public class HelloWorldController {
	@RequestMapping("")
	public String helloWorldTest(Model model){
		return "index";
	}

	//先于RequestMapping执行
	@ModelAttribute("acceptLanguage")
	public String getRequestHead(@RequestHeader("Accept-Language")String acceptLanguage){
		return acceptLanguage;
	}

	@ModelAttribute("jSessionId")
	public String getJSessionId(@CookieValue("JSESSIONID")String jSessionId){
		return jSessionId;
	}
}
